<template>
  <view class="news-detail">
    <!-- 新闻标题 -->
    <view>
      <h2 class="title">{{ news.title }}</h2>
    </view>
    <view class="meta">
      <span>{{ news.publish_date.substring(0, 10) }}</span>
	  <span>新闻来源：{{ news.author }}</span>
    </view>
    <view class="pic">
        <image class="news-image" :src="news.pic"></image>
    </view>
    <!-- 新闻配图 -->


    <!-- 新闻内容 -->
    <view class="news-content" >
      <text>{{news.detail}}</text></view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      news: {
        detail:''
      }
    };
  },

  created() {
    this.detail()
  },
  methods: {
    detail() {
      // 获取query对象
      const query = this.$route.query;
      // 获取code参数
      const id = query.id;
      this.$u.get('/news/detail', {
        id: id
      }).then(res => {
        console.log(res)
        this.news = res;
      })
    },
  }
};
</script>

<style scoped>
	.title{
		font-weight: 900;
		font-size: 50rpx;
	}
	.meta{
		display: flex;
		justify-content: space-between;
		margin-top: 40rpx;
		color: #aaa;
		font-weight: 600;
		font-size: 25rpx;
	}
.news-detail{
  padding: 10px;
}
.pic{
  text-align: center;
}
.news-content{
	color: #30302E;
	line-height: 40rpx;
	font-weight: 600;
}
</style>
